package com.dingding.order.core.special.biz.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.dingding.common.core.beans.special.UserspecialorderT;
import com.dingding.common.core.util.ToolUtil;
import com.dingding.order.common.dto.special.ReqGetSpecialOrdertByIdDTO;
import com.dingding.order.core.special.biz.ISpecialOrdertService;
import com.dingding.order.core.special.dao.IUserSpecialOrdertDao;

/**
 * 
 * @ClassName: SpecialOrdertServiceImpl 
 * @Description: 专车临时订单业务逻辑实现类
 * @author YHQ
 * @date 2016年12月8日 上午10:20:22
 * @since V2.5.7
 * 
 */
@Component("specialOrdertService")
public class SpecialOrdertServiceImpl implements ISpecialOrdertService{

	@Resource(name = "userSpecialOrdertDao")
	private IUserSpecialOrdertDao userSpecialOrdertDao;
	
	/**
	 * 
	 * @Title: getUserSpecialOrdert 
	 * @Description: 根据用户Id获取订单信息
	 * @param reqGetSpecialOrdertByIdDTO 订单Id
	 * @author YHQ 
	 * @since V2.5.7
	 * @return UserspecialorderT    返回类型
	 * 
	 */
	@Override
	public UserspecialorderT getUserSpecialOrdert(ReqGetSpecialOrdertByIdDTO reqGetSpecialOrdertByIdDTO) {
		
		// 验证客户端请求参数
		if(reqGetSpecialOrdertByIdDTO == null || !ToolUtil.validateParam(reqGetSpecialOrdertByIdDTO)){
			return null;
		}
		
		// 根据用户Id获取订单信息
		return userSpecialOrdertDao.getUserSpecialOrderT(reqGetSpecialOrdertByIdDTO.getOrderId());
	}

	/**
	 * 
	 * @Title: updateSpecialOrder 
	 * @Description: 修改订单临时变数据 
	 * @param userspecialorderT 要修改的订单信息
	 * @author YHQ 
	 * @since V2.5.7
	 * @return Boolean    返回类型
	 * 
	 */
	@Override
	public Boolean updateSpecialOrder(UserspecialorderT userspecialorderT) {
		
		if(userspecialorderT == null){
			return false;
		}
		
		return userSpecialOrdertDao.updateSpecialOrderById(userspecialorderT);
	}
	
}
